import request from '@/utils/request'

// 查询用户统计列表
export function listConsumer(query) {
  return request({
    url: '/business/consumer/list',
    method: 'get',
    params: query
  })
}
//根据用户ID查询开电成功过的订单,
export function getOrderInfo(id, query) {
  return request({
    url: `/business/order/getOrderInfo/${id}`,
    method: 'get',
    params: query
  })
}

// 查询用户统计详细
export function getConsumer(id) {
  return request({
    url: '/business/consumer/' + id,
    method: 'get'
  })
}

// 新增用户统计
export function addConsumer(data) {
  return request({
    url: '/business/consumer',
    method: 'post',
    data: data
  })
}

// 修改用户统计
export function updateConsumer(data) {
  return request({
    url: '/business/consumer',
    method: 'put',
    data: data
  })
}

// 删除用户统计
export function delConsumer(id) {
  return request({
    url: '/business/consumer/' + id,
    method: 'delete'
  })
}

// 根据用户ID查询账户详情
export function getAccountDetail(cid) {
  return request({
    url: `/business/consumer/getAccountDetail/${cid}`,
    method: 'get'
  })
}

// 不分页查所有启用的小程序功能区
export function getAppletManagerModule(cid) {
  return request({
    url: `/business/appletManagerModule/selectModulesByCid/${cid}`,
    method: 'get'
  })
}

// 保存小程序功能区
export function saveConsumerManagerModules(data) {
  return request({
    url: `/business/consumer/saveConsumerManagerModules`,
    method: 'post',
    data: data
  })
}

// 不分页查所有启用的场站功能区
export function getStationManagerModule(cid) {
  return request({
    url: `/business/consumer/selectStationMangersByCid/${cid}`,
    method: 'get'
  })
}

// 保存场站功能区
export function saveConsumerStationManagerModules(data) {
  return request({
    url: `/business/consumer/saveConsumerStations`,
    method: 'post',
    data: data
  })
}

export function clearBalance(masterId) {
  return request({
    url: `/business/consumer/clearBalance/${masterId}`,
    method: 'get'
  })
}

// 充值余额 post 请求
export function addBalance(data) {
  return request({
    url: `/business/consumer/addBalance`,
    method: 'post',
    data: data
  })
}

